<form action="{:U('Message/send')}" method="post">

	<ul class="nav nav-tabs">
		<volist name="departments_list" id="vo" key="k">
			<li <if condition="$vo['department_id'] eq session('department_id')">class="active"</if>>
				<a class="ta" rel="{$k}" data-toggle="tab">{$vo['name']}</a>
			</li>
		</volist>
	</ul>
	<volist name="departments_list" id="vo" key="k">
		<div class="tab-pane <if condition="$vo['department_id'] neq session('department_id')">hide</if>" id="ta{$k}">
			<input type="checkbox" class="check_all" rel="{$k}"/>{:L('SELECT_ALL')}<br/>
			<volist  name="vo['user']" id="temp">
				<span style="width:25%; float:left;"><input type="checkbox" class="muti_role_id muti_role_id{$k}" name="to_role_id[]" rel="{$temp['user_name']}" value="{$temp.role_id}"/>{$temp['user_name']}【{$temp.role_name}】&nbsp; </span>
			</volist>
		</div>
	</volist>

</form>
<script type="text/javascript">
	
$(function(){
	$('.ta').click(
		function(){
			var num = $(this).attr('rel');
			var list = new Array();
			<volist name="departments_list" id="vo" key="k">
				list.push({$k});
			</volist>
			for (var i=0;i<list.length;i++){
				if(num == list[i]){
					$('#ta'+(i+1)).show();
				}else{
					$('#ta'+(i+1)).hide();
				}
			}
		}
	);
	$('.check_all').click(
		function(){
			var k = $(this).attr('rel');
			$("input.muti_role_id"+k).prop('checked', $(this).prop("checked"));
		}
	);
});
</script>